//
//  LzwHandTableViewCell.m
//  NewHalfsugar
//
//  Created by 刘志武 on 16/1/2.
//  Copyright © 2016年 刘志武. All rights reserved.
//

#import "LzwHandTableViewCell.h"
#import "UIImageView+WebCache.h"
#import "LzwBaseImageView.h"
#import "LzwBaseLable.h"

@interface LzwHandTableViewCell ()

@property (nonatomic, retain) LzwBaseImageView *myImageHandView;
@property (nonatomic, retain) LzwBaseImageView *myImageHandView1;

@property (nonatomic, retain) LzwBaseLable *myLableHand;
@property (nonatomic, retain) LzwBaseLable *myLableHand1;

@end

@implementation LzwHandTableViewCell

-(instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
    
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    
    if (self) {
        [self creatHand];
    }
    
    return self;
}


-(void)creatHand{
    
    //图片
    self.myImageHandView = [[LzwBaseImageView alloc]initWithFrame:CGRectMake(3 * WIDTH, 3 * WIDTH, 370 * WIDTH, 180 * WIDTH)];
    self.myImageHandView.backgroundColor = [UIColor whiteColor];
    [self.contentView addSubview:self.myImageHandView];
    
    //喜爱图片
    self.myImageHandView1 = [[LzwBaseImageView alloc]initWithFrame:CGRectMake((375 - 20) / 2 - 70 * WIDTH, 230 * WIDTH, 20 * WIDTH, 20 * WIDTH)];
    self.myImageHandView1.image = [UIImage imageNamed:@"love.png"];
    [self.contentView addSubview:self.myImageHandView1];
    
    //描述
    self.myLableHand = [[LzwBaseLable alloc]initWithFrame:CGRectMake(2 * WIDTH, 185 * WIDTH, 369 * WIDTH, 45 * WIDTH)];
    self.myLableHand.textColor = [UIColor lightGrayColor];
    self.myLableHand.font = [UIFont systemFontOfSize:16 * WIDTH];
    self.myLableHand.textAlignment = NSTextAlignmentCenter;
    [self.contentView addSubview:self.myLableHand];
    
    //喜爱人数
    self.myLableHand1 = [[LzwBaseLable alloc]initWithFrame:CGRectMake((375 - 20) / 2 - 50 + 5 * WIDTH, 230 * WIDTH, 60 * WIDTH, 20 * WIDTH)];
    self.myLableHand1.textColor = [UIColor lightGrayColor];
    self.myLableHand1.font = [UIFont systemFontOfSize:16 * WIDTH];
    self.myLableHand1.textAlignment = NSTextAlignmentCenter;
    [self.contentView addSubview:self.myLableHand1];
    
    [_myImageHandView release];
    [_myImageHandView1 release];
    [_myLableHand release];
    [_myLableHand1 release];

    
}

-(void)setModleHand:(LzwHandModle *)modleHand{
    
    if (_modleHand != modleHand) {
        [_modleHand release];
        
        _modleHand = [modleHand retain];
    }
    
    self.myLableHand.text = self.modleHand.title;
    self.myLableHand1.text = self.modleHand .likes;
    
    NSURL *url = [NSURL URLWithString:self.modleHand.pic];
    
    [self.myImageHandView sd_setImageWithURL:url placeholderImage:nil];
    

    
    
}


@end
